import URL from '@/config/url'
import utils from '@/utils/utils'

export default {
	// 首页==
	// 产品包列表
	getpackList(params = {}) {
		let data = {
			page: params.page,
			pagesize: params.pagesize,
			is_hot: params.is_hot,
			style_id: params.style_id,
			floor: params.floor,
			price: params.price,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/packList',
			data
		})
	},
	// 产品包banner
	getbanner(params = {}) {
		let data = {
			type: params.type
		}
		return utils.uniRequest({
			url: URL.BASE + '/base/banner',
			data
		})
	},
	// 产品包详情
	getPackDetail(params = {}) {
		let data = {
			pack_id: params.pack_id, // 产品包id(string)
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/userPackDetail',
			data
		})
	},
	// 产品包分类
	class_getList(params = {}) {
		let data = {
			pack_id: params.pack_id, // 产品包id(string)
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/packDiy',
			data
		})
	},
	// 产品包分类商品
	packProduct(params = {}) {
		let data = {
			pack_id: params.pack_id, // 产品包id(string)
			cate_id: params.cate_id, // 分类id(string)
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/packProduct',
			data
		})
	},
	// 可替换商品
	packreplacePackLst(params = {}) {
		let data = {
			diy_list_id: params.diy_list_id, // 产品商品id(string)
			pack_id: params.pack_id, // 产品包id(string)
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/replacePackLst',
			data
		})
	},
	// 可替换商品详情
	replaceProductDetail(params = {}) {
		let data = {
			diy_list_id: params.diy_list_id, // 
			product_id: params.product_id, // id(string)
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/replaceProductDetail',
			data
		})
	},
	// 替换商品
	replaceProduct(params = {}) {
		let data = {
			pack_id: params.pack_id, // 产品包id(string)
			product_id: params.product_id, // id(string)
			diy_list_id: params.diy_list_id,
			sku_id: params.sku_id,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/replaceProduct',
			data
		})
	},
	// 产品包商品详情
	packProductDetail(params = {}) {
		let data = {
			pack_id: params.pack_id, // 产品包id(string)
			diy_list_id: params.diy_list_id, // id(string)
			product_id: params.product_id,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/packProductDetail',
			data
		})
	},
	// 选择规格
	packsetSpec(params = {}) {
		let data = {
			pack_id: params.pack_id, // 产品包id(string)
			diy_list_id: params.diy_list_id, // id(string)
			sku_id: params.sku_id,
			product_id: params.product_id,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/setSpec',
			data
		})
	},
	// 商品海报
	goods_getshare(params = {}) {
		let data = {
			product_id: Number(params.product_id), // 商品id(int)
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/product/share',
			data
		})
	},
	// 确认订单
	getOrder(params = {}) {
		let data = {
			origin_type: params.origin_type,
			cart_ids: params.cart_ids,
			goods: params.goods,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/order/back_delivery',
			data
		})
	},
	// 提交订单
	getupOrder(params = {}) {
		let data = {
			origin_type: params.origin_type,
			cart_ids: params.cart_ids,
			goods: params.goods,
			address_id: params.address_id,
			share_id: params.share_id
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/order/back_unified',
			data
		})
	},
	// 订单列表
	getupOrderlist(params = {}) {
		let data = {
			page: params.page,
			pagesize: 10,
			order_status: params.order_status,
			keyword: params.keyword
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/order/productPackOrderLst',
			data
		})
	},
	// 取消订单
	getupOrdercancel(params = {}) {
		let data = {
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/order/cancel_back',
			data
		})
	},

	// 删除订单
	getdelProductOrder(params = {}) {
		let data = {
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/order/delProductPackOrder',
			data
		})
	},
	// 订单详情
	getdata(params = {}) {
		let data = {
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/order/back_detail',
			data
		})
	},
	// 待收货列表
	getreceivedList(params = {}) {
		let data = {
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/Order/back_receivedList',
			data
		})
	},
	// 确认收货
	getrececonfirm(params = {}) {
		let data = {
			id_lst: params.id_lst,
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/shop/Order/back_confirm',
			data
		})
	},
	// 超级管家产品包
	stewardProductPack(params = {}) {
		let data = {
			steward_id: params.steward_id,
			page: params.page,
			pagesize: params.pagesize,
		}
		return utils.uniRequest({
			url: URL.BASE + '/steward/teams/product_packs',
			data
		})
	},
	// 超级管家促销商品
	stewardProduct(params = {}) {
		let data = {
			steward_id: params.steward_id,
			page: params.page,
			pagesize: params.pagesize,
		}
		return utils.uniRequest({
			url: URL.BASE + '/steward/teams/products',
			data
		})
	},

	// 产品包详情
	newPackDetail(params = {}) {
		let data = {
			pack_id: params.pack_id, // 产品包id(string)
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/data/detail',
			data
		})
	},
	//产品包下的商品
	newProductsGoods(params = {}) {
		let data = {
			pack_id: params.pack_id, // 产品包id(string)
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/data/products',
			data
		})
	},
	//产品包下的商品详情
	productsGoodsDetail(params = {}) {
		let data = {
			product_id: params.product_id,
			pack_id:params.pack_id,
			diy_list_id:params.diy_list_id
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/data/product_detail',
			data
		})
	},
	// 产品包提交订单
	getnewUpOrder(params = {}) {
		let data = {
			origin_type: params.origin_type,
			cart_ids: params.cart_ids,
			goods: params.goods,
			address_id: params.address_id,
			share_id: params.share_id
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/order/submit',
			data
		})
	},
	// 产品包确认订单
	getNewOrder(params = {}) {
		let data = {
			origin_type: params.origin_type,
			cart_ids: params.cart_ids,
			goods: params.goods,
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/order/confirm',
			data
		})
	},
	// 产品包订单列表
	getNewOrderlist(params = {}) {
		let data = {
			page: params.page,
			pagesize: params.pagesize,
			order_status: params.order_status,
			keyword: params.keyword
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/order/list',
			data
		})
	},
	// 订单详情
	getPackDetails(params = {}) {
		let data = {
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/order/detail ',
			data
		})
	},
	// 产品包取消订单
	packOrdercancel(params = {}) {
		let data = {
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/order/delete',
			data
		})
	},
	// 产品包确认收货
	packrececonfirm(params = {}) {
		let data = {
			id_lst: params.id_lst,
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/order/confirm_sign',
			data
		})
	},
	// 产品包待收货列表
	packReceivedList(params = {}) {
		let data = {
			order_code: params.order_code,
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/order/confirm_list',
			data
		})
	},
	// 产品包添加购物车
	packCartAdd(params = {}) {
		let data = {
			pack_id: params.pack_id,
			sku_id:params.sku_id
		}
		return utils.uniRequest({
			url: URL.BASE + '/newpk/cart/add',
			data
		})
	},
}
